package org.budo.poi.util;

import java.util.Iterator;

import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

/**
 * @author lmw
 */
public class ExcelReader {
    public static void main(String[] args) throws Throwable {
        OPCPackage oPCPackage = OPCPackage.open("D:\\Software\\QQ\\Data\\416133823\\FileRecv\\template (2).xlsx");
        XSSFWorkbook workbook = new XSSFWorkbook(oPCPackage);
        // workbook.getNumberOfSheets();
        XSSFSheet sheet = workbook.getSheetAt(0);
        Iterator<Row> rowIterator = sheet.rowIterator();
        while (rowIterator.hasNext()) {
            Row row = (Row) rowIterator.next();
            Iterator<Cell> cellIterator = row.cellIterator();
            while (cellIterator.hasNext()) {
                Cell cell = (Cell) cellIterator.next();
                // if(cell.getStringCellValue()) // 
                System.err.println(cell);
            }
        }
    }
}